package com.lmabbe.core.common.entitys;

import com.baomidou.mybatisplus.annotation.*;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.IsNativeDefValue;
import com.gitee.sunchenbin.mybatis.actable.annotation.Table;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import com.lmabbe.common.global.constant.GlobalConstant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

/**
 * @author lmabbe
 * @TableName sys_user
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "用户")
@Table(isSimple = true, comment = "用户表")
public class SysUser implements Serializable {

    /**
     * ID
     */
    @TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "用户ID")
    @Column(isKey = true, isNull = false, length = 32, comment = "用户ID")
    private Long userId;

    /**
     * 姓名
     */
    @TableField()
    @ApiModelProperty(value = "姓名")
    @Column(comment = "姓名")
    private String userName;

    /**
     * 头像
     */
    @TableField()
    @ApiModelProperty(value = "头像")
    @Column(comment = "头像")
    private String userAvatar;

    /**
     * 手机
     */
    @TableField()
    @ApiModelProperty(value = "手机")
    @Column(comment = "手机")
    private String userMobile;

    /**
     * 邮箱
     */
    @TableField()
    @ApiModelProperty(value = "邮箱")
    @Column(comment = "邮箱")
    private String userEmail;

    /**
     * 性别 0.未知 1.男 2.女
     */
    @TableField()
    @ApiModelProperty(value = "性别 0.未知 1.男 2.女")
    @Column(comment = "性别 0.未知 1.男 2.女", defaultValue = "0")
    private Integer userSex;

    /**
     * 账号
     */
    @TableField()
    @ApiModelProperty(value = "账号")
    @Column(comment = "账号", isNull = false)
    private String userAccount;

    /**
     * 密码
     */
    @TableField()
    @ApiModelProperty(value = "密码")
    @Column(comment = "密码", isNull = false)
    private String userPassword;

    /**
     * 部门ID
     */
    @TableField()
    @ApiModelProperty(value = "部门ID")
    @Column(comment = "部门ID", isNull = false)
    private Long orgId;

    /**
     * 岗位ID
     */
    @TableField()
    @ApiModelProperty(value = "岗位ID")
    @Column(comment = "岗位ID", isNull = false)
    private Long stationId;

    /**
     * 内置
     */
    @TableField()
    @ApiModelProperty(value = "内置")
    @Column(comment = "是否内置 true:是 false:否", defaultValue = "false")
    private Boolean readonly;

    /**
     * 最后一次输错密码时间
     */
    @TableField()
    @ApiModelProperty(value = "最后一次输错密码时间")
    @Column(comment = "最后一次输错密码时间")
    private Date passwordErrorLastTime;

    /**
     * 密码错误次数
     */
    @TableField()
    @ApiModelProperty(value = "密码错误次数")
    @Column(comment = "密码错误次数", defaultValue = "0")
    private Integer passwordErrorNum;

    /**
     * 密码过期时间
     */
    @TableField()
    @ApiModelProperty(value = "密码过期时间")
    @Column(comment = "密码过期时间")
    private Date passwordExpireTime;

    /**
     * 最后登录时间
     */
    @TableField()
    @ApiModelProperty(value = "最后登录时间")
    @Column(comment = "最后登录时间")
    private Date lastLoginTime;

    /**
     * 是否有效(1.有效 0.无效 -1.软删除)
     */
    @TableField()
    @ApiModelProperty(value = "是否有效(1.有效 0.无效 -1.软删除)")
    @Column(comment = "是否有效(1.有效 0.无效 -1.软删除)", defaultValue = "1")
    @TableLogic(value = GlobalConstant.IS_VALID.YES_STR, delval = GlobalConstant.IS_VALID.DELETE_STR)
    private Integer valid;

    /**
     * 创建人
     *
     * @mbg.generated 2021-03-13 16:06:09
     */
    @TableField(fill = FieldFill.INSERT)
    @Column(isNull = false, comment = "创建人", defaultValue = "system")
    private String createBy;
    /**
     * 创建时间
     *
     * @mbg.generated 2021-03-13 16:06:09
     */
    @IsNativeDefValue
    @TableField(fill = FieldFill.INSERT)
    @Column(isNull = false, comment = "创建时间", type = MySqlTypeConstant.TIMESTAMP, defaultValue = "CURRENT_TIMESTAMP")
    private Date createTime;
    /**
     * 修改人
     *
     * @mbg.generated 2021-03-13 16:06:09
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @Column(isNull = false, comment = "修改人", defaultValue = "system")
    private String modifyBy;
    /**
     * 修改时间
     *
     * @mbg.generated 2021-03-13 16:06:09
     */
    @IsNativeDefValue
    @Column(isNull = false, comment = "修改时间", type = MySqlTypeConstant.TIMESTAMP, defaultValue = "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date modifyTime;

}